package Object.lambda;

/**
 * @author haomin
 * @date 2022/11/12 10:38
 **/

// 无返回值无参
interface NonReturnNonParameter{
    void test();
}

// 无返回值有参
interface NonReturnHasParameter{
    void test(String name, int age);
}

// 有返回值无参
interface HasReturnNonParameter{
    String test();
}

// 有返回值有参
interface HasReturnHasParameter{
    String test(String name, int age);
}

public class LambdaUsage {
    public static void main(String[] args) {
        NonReturnNonParameter i1 = () -> System.out.println("Lambda 无返回值无参");
        i1.test();

        NonReturnHasParameter i2 = (name, age) -> System.out.println("Lambda 无返回值有参");
        i2.test("张三", 18);

        HasReturnNonParameter i3 = () -> "Lambda 有返回值无参";
        System.out.println(i3.test());

        HasReturnHasParameter i4 = (name, age) -> "Lambda 有返回值有参";
        System.out.println(i4.test("张三", 18));
    }
}